refactor: increase shared-constants.sh adoption from 17% to 93% (t135.8)#480
refactor: increase shared-constants.sh adoption from 17% to 93% (t135.8)#480marcusquinn merged 3 commits intomainfrom
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Important Review skippedToo many files! This PR contains 155 files, which is 5 over the limit of 150. You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Migrate 132 scripts to source shared-constants.sh, removing ~2800 lines of duplicated inline print_*/color definitions: - Add print_error/success/warning/info aliases to shared-constants.sh - Add short color variable aliases (RED, GREEN, NC, etc.) - Remove inline print_* function definitions from migrated scripts - Remove inline color variable declarations (now provided by shared) - Remove re-declared readonly constants that conflict with shared 11 scripts intentionally excluded (no color output or print functions). All 171 scripts pass bash -n syntax validation.
Add color aliases (RED, GREEN, NC, etc.) and print_* short aliases (print_error, print_info, etc.) to shared-constants.sh so scripts can source it instead of defining their own inline copies. Migrate 163 scripts to source shared-constants.sh, removing ~2900 lines of duplicated color definitions and print functions. Fix syntax error in clawdhub-helper.sh (invalid 'then || exit' pattern). Remaining 11 scripts either use no colors/prints (10) or use a namespaced color scheme (loop-common.sh with LC_ prefix). Adoption: 163/174 scripts (93.7%), exceeding the 80%+ target.
245ed07 to
f505f95
Compare
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Feb 7 20:42:26 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
|
…urce lines PR #480 (shared-constants adoption) added source lines to scripts that already had them from PR #479 (sed portability), causing double-sourcing. Under set -euo pipefail, the second source fails on readonly re-declaration, silently breaking supervisor-helper.sh (batch, help, all commands return 1). Fix: Add include guard (_SHARED_CONSTANTS_LOADED) so shared-constants.sh is safe to source multiple times. Also remove 5 duplicate source lines.
…urce lines (#483) PR #480 (shared-constants adoption) added source lines to scripts that already had them from PR #479 (sed portability), causing double-sourcing. Under set -euo pipefail, the second source fails on readonly re-declaration, silently breaking supervisor-helper.sh (batch, help, all commands return 1). Fix: Add include guard (_SHARED_CONSTANTS_LOADED) so shared-constants.sh is safe to source multiple times. Also remove 5 duplicate source lines.



Summary
RED,GREEN,NC, etc.) andprint_*short aliases (print_error,print_info, etc.) toshared-constants.shso scripts can source it instead of defining their own inline copiessource shared-constants.sh, removing ~2,900 lines of duplicated color definitions and print functionsclawdhub-helper.sh(invalid); then || exitpattern from prior migration attempt)Details
Before: 29/170 scripts (17%) sourced
shared-constants.shAfter: 163/174 scripts (93.7%) source
shared-constants.shThe remaining 11 scripts either:
loop-common.shwithLC_prefix) to avoid conflicts when sourced by other scriptsChanges to
shared-constants.shRED,GREEN,YELLOW,BLUE,PURPLE,CYAN,WHITE,NCas short aliases for the existingCOLOR_*constantsprint_error(),print_success(),print_warning(),print_info()as short aliases for the existingprint_shared_*()functionsPer-script changes (163 scripts)
Each script received the same pattern:
SCRIPT_DIRresolution (if not already present)source "${SCRIPT_DIR}/shared-constants.sh"RED=,GREEN=,NC=, etc.)print_error/print_success/print_warning/print_infofunction definitions (where they duplicated shared-constants)BOLD,DIMthat aren't in shared-constantsQuality checks
bash -nsyntax check: 163/163 passprint_*without sourcingshared-constants.shCloses t135.8